<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>立体呈现</title>
    <style>
        .cube {
            position: relative;
            width: 200px;
            height: 200px;
            margin: 100px auto;
            /* background-color: pink; */
            /* 过渡 */
            transition: all 2s;
            /* 1.父级变立方体 */
            transform-style: preserve-3d;
            /* 旋转89度 */
            /* transform: rotateY(89deg); */
        }

        .cube div {
            /* 2.子级绝对，父级相对 */
            position: absolute;
            left: 0;
            top: 0;
            
            width: 200px;
            height: 200px;
        }

        .front {
            background-color: orange;
            /* 子级一个前移，一个后移 */
            transform: translateZ(100px);
        }

        .back {
            background-color: red;
            transform: translateZ(-100px);
        }

        .cube:hover {
            transform: rotateY(90deg);
        }
    </style>
</head>

<body>
    <div class="cube">
        <div class="front">前面</div>
        <div class="back">后面</div>
    </div>
</body>
</html>